﻿using RiskDataAccessLayer.Managers.Interfaces;
using RiskDomain.Exceptions;
using RiskDomain.Interfaces;

namespace RiskDataAccessLayer.Managers.Implementations
{
    internal class RiskManager : IRiskManager
    {
        public void AddNewPlayer(IPlayer p)
        {
            if (p == null)
            {
                throw new RiskException("Try to create a new player with a NULL reference.");
            }
            using (var db = new RiskContext())
            {
                db.Players.Add(p);
                db.SaveChanges();
            }
        }
    }
}